﻿using System.Diagnostics;
using TotalApplication.Core;

namespace TotalApplication.AngelSix
{
    public static class ApplicationPageHelper
    {
        public static BasePage ToBasePage(this ApplicationPage page)
        {
            switch (page)
            {
                case ApplicationPage.Login:
                    return new LoginPage();

                case ApplicationPage.Chat:
                    return new ChatPage();

                case ApplicationPage.Register:
                    return new RegisterPage();

                default:
                    Debugger.Break();
                    return null;
            }
        }

        public static BasePage ToBasePage(this ApplicationPage page, BaseViewModel viewModel)
        {
            switch (page)
            {
                case ApplicationPage.Login:
                    return new LoginPage(viewModel as LoginViewModel ?? new LoginViewModel());

                case ApplicationPage.Chat:
                    return new ChatPage(viewModel as ChatMessageListViewModel ?? new ChatMessageListViewModel());

                case ApplicationPage.Register:
                    return new RegisterPage(viewModel as RegisterViewModel ?? new RegisterViewModel());

                default:
                    Debugger.Break();
                    return null;
            }
        }
    }
}
